﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Joyeon.Utils
{
    public static class MathUtil
    {
        /// <summary>
        /// 获得指定精度的单精度值
        /// 四舍五入
        /// </summary>
        /// <param name="value"></param>
        /// <param name="digits"></param>
        /// <returns></returns>
        public static double GetRoundValue(float value, int digits)
        {
            return Math.Round(value, digits);
        }

        /// <summary>
        /// 获得保留两位小数的单精度值
        /// 四舍五入
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static double GetRoundValue(float value)
        {
            return GetRoundValue(value, 2);
        }
    }
}
